import request from '@/utils/request'

//订单管理
const ORDER_URL = 'api/admin/orders'

//取消订单
export const cancel = (cancel)=>{
    return request.put(ORDER_URL+'/cancel',cancel)
}

//完成订单
export const complete = (id)=>{
    return request.put(ORDER_URL+'/complete/'+id)
}

//订单搜索
export const conditionSearch = (beginTime,endTime,number,page,pageSize,phone,status,storeId,userId)=>{
    return request.get(ORDER_URL+'/conditionSearch?beginTime='+beginTime
        +'&endTime='+endTime
        +'&number='+number
        +'&page='+page
        +'&pageSize='+pageSize
        +'&status='+status
        +'&storeId='+storeId
        +'&userId='+userId
        +'&phone='+phone)
}

//接单
export const confirm = (confirm)=>{
    return request.put(ORDER_URL+'/confirm',confirm)
}

//派送
export const delivery = (id)=>{
    return request.put(ORDER_URL+'/delivery/'+id)
}

//查询订单详情
export const details = (id)=>{
    return request.get(ORDER_URL+'/details/'+id)
}

//拒单
export const rejection = (rejection)=>{
    return request.put(ORDER_URL+'/rejection',rejection)
}

//各个订单状态数量统计
export const statistics = ()=>{
    return request.get(ORDER_URL+'/statistics')
}